package com.mywork.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.ciko.code.bean.AttendanceRecordBaen;
import com.mywork.R;

import java.text.SimpleDateFormat;
import java.util.Date;

public class AttendanceDetails extends Activity {
    private ImageView img_back;
    private TextView txt_name;
    private TextView txt_date;
    private TextView txt_drr;
    private TextView txt_reason;
    AttendanceRecordBaen data;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_attendance_details);
//        //透明状态栏
//        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//        //透明导航栏
//        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

        img_back = (ImageView) findViewById(R.id.img_back);
        img_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        data = (AttendanceRecordBaen) getIntent().getSerializableExtra("att");

        txt_name = (TextView) findViewById(R.id.txt_name);
        txt_date = (TextView) findViewById(R.id.txt_date);
        txt_drr = (TextView) findViewById(R.id.txt_drr);
        txt_reason = (TextView) findViewById(R.id.txt_reason);

        txt_name.setText(data.getCustName());
        txt_reason.setText(data.getVisitCause());
        txt_date.setText(getDate(data.getVisitTime()));
        txt_drr.setText(data.getCustAddr());
    }

    private String getDate(long curr) {
        Date date = new Date(curr);
        SimpleDateFormat format = new SimpleDateFormat("MM月dd日 HH:mm");
        return format.format(date);
    }
}
